<link href="<?php echo URL::base() ?>media/vendor/css/ui-lightness/jquery-ui-1.10.4.custom.css" rel="stylesheet">
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-1.10.2.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery-ui-1.10.4.custom.js"></script>
<script src="<?php echo URL::base() ?>media/vendor/js/jquery.ui.datepicker-zh-TW.js"></script>
<style>
    .myborder , .myborder th , .myborder td{border: 1px solid #ffffff;}
    .control-label{ display:inline-block; width:80px; text-align:right; margin-right:10px;}
    .table1 thead tr td,.table1 tbody tr td{ text-align:center;}
    .content-table{
        overflow: auto;
        width:100%;
        max-height: 500px;
    }
    .content-table table{
        width:2000px;
    }
</style>
<script type="text/javascript">
    $(document).ready(function(){
        $('.table1 > tbody > tr:odd').css("background-color","#f5f5f5");
    })
</script>
<form method='get' action='<? echo URL::site() ?>report/saleorders/select'>
    <div class="control-group">
        <label class="control-label" >时间选择:</label>
        <input type='text' style="width:164px;" name='date_from' class=" datepicker" id="date_from" > ~ <input type='text' name='date_to' style="width:164px;" id='date_to' class=" datepicker" >
    </div>
    <div class="control-group">
        <label class="control-label" >挂号码:</label>
        <input type='text' style="width:164px;" name='mailcode' id='mailcode'>
    </div>
    <div class="control-group">
        <label class="control-label"></label>
        <input type='submit' class="btn btn-info" value='查询'>
        <!--<input type='button' class="btn btn-success" value='全部下载' onclick="down_all()">-->
    </div>

</form>
<div class="content-table">
    <table class="table table1 table-bordered myborder ">
        <thead class="table-fixedtd">
        <tr style="background-color:#4EA392; font-weight:bold; color:#ffffff; width: 1400px">
        <th>物流方式</th>
        <th>订单-内</th>
        <th>订单-外</th>
        <th>买家id</th>
        <th>买家邮箱</th>
        <th>收货人</th>
        <th>国家(全拼)</th>
        <th>国家(中文)</th>
        <th>总金额</th>
        <th>重量</th>
        <th>运费</th>
        <th>销售帐号</th>
        <th>订单状态</th>
        <th>客服人员</th>
        <th>发货时间</th>
        <th>包裹挂号码</th>
        <th>发货渠道</th>
        <th>订单-内</th>
        </tr>
        </thead>
        <tbody>
        <?php if(isset($orders)):
            foreach($orders as $order):?>
            <tr>
                <td><?php echo $order['order_type_name']?></td>
                <td><?php echo $order['erp_orders_id']?></td>
                <td><?php echo $order['ebay_orders_id']?></td>
                <td><?php echo $order['buyer_id']?></td>
                <td><?php echo $order['buyer_email']?></td>
                <td><?php echo $order['buyer_name']?></td>
                <td><?php echo $order['buyer_country']?></td>
                <td><?php echo $order['country_cnname']?></td>
                <td><?php echo $order['ordertotal']?></td>
                <td><?php echo $order['heavi']?></td>
                <td><?php echo $order['fee']?></td>
                <td><?php echo $order['sales_account']?></td>
                <td><?php echo $order['orders_status']?></td>
                <td><?php echo $order['serivename']?></td>
                <td><?php echo $order['orders_out_time']?></td>
                <td><?php echo ($order['orders_mail_code']!='')?$order['orders_mail_code']:$order['orders_shipping_code']?></td>

                <td><?php echo $order['postname']?></td>
                <td><?php echo $order['erp_orders_id']?></td>

            </tr>
        <?php endforeach;endif;?>
        </tbody>
    </table>
    <?php if(isset($pagination))echo $pagination;?>
</div>
<script type="text/javascript">
    $(function(){

        $("#date_from").val('<?php echo isset($starttime)?$starttime:''?>');
        $("#date_to").val('<?php echo isset($endtime)?$endtime:''; ?>');
        $("#mailcode").val('<?php echo isset($mailcode)?$mailcode:''; ?>');
        $.datepicker.setDefaults({ dateFormat: 'yy-mm-dd' });
        $("#date_from").datepicker({
            onSelect:function(dateText,inst){
                $("#date_to").datepicker("option","minDate",dateText);
            }
        });
        $("#date_to").datepicker({
            onSelect:function(dateText,inst){
                $("#date_from").datepicker("option","maxDate",dateText);
            }
        });
    });

    function down_all()
    {
        var date_from = $('#date_from').val();
        var date_to = $('#date_to').val();
        var $mailcode = $('#mailcode').val();
        window.location.href="<?php echo URL::site(); ?>report/saleorders/down?date_from="+date_from+"&date_to="+date_to+"&mailcode="+mailcode;

    }
</script>
